var _util = require('util/util.js')
var vue = require('./../common/vue')
const _market_service = require('service/market-service');
const _catalog_service = require("service/catalog-service.js");

var new_cate = new vue({
    el: "#new_cate",
    data: {
        editcategoryname: "",
        editpicture : "100",
    },
    methods: {
        setinfo : function(){

        },
        addcategory : function () {
            new_cate.editpicture = $("#file-uploader").val()

            new_cate.editpicture = new_cate.editpicture.split(".")[0];
            new_cate.editpicture = new_cate.editpicture.split("/");
            length = new_cate.editpicture.length;
            new_cate.editpicture = new_cate.editpicture[length - 1];
            new_cate.editpicture = new_cate.editpicture.split("\\");
            length = new_cate.editpicture.length;
            new_cate.editpicture = new_cate.editpicture[length - 1];
            console.log(new_cate.editpicture)
            console.log(new_cate.editcategoryname)
            _catalog_service.addoneclass(
                JSON.stringify({
                    name: new_cate.editpicture,
                    pictureid: new_cate.editpicture
                },),
                function (res) {
                    alert("添加成功")
                    console.log(res)
                },
                function (err) {
                    alert("添加失败")
                    console.log(err)
                }
            )
        },
    },
    //初始化vue对象，渲染数据
    created: function () {
    },

})